<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="关键字">
              <a-input placeholder="请输入统一信用代码、简称等" v-model="queryParam.key"></a-input>
            </a-form-item>
          </a-col>
        
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!--      <a-button type="primary" icon="download" @click="handleExportXls('企业基本信息表')">导出</a-button>-->
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
<!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!--        <a-menu slot="overlay">-->
<!--          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!--        </a-menu>-->
<!--        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
<!--      </a-dropdown>-->
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;height:40px;">
        <!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a> -->
        <setColumnFields @chooseFields="chooseFields" :columns="columnsCopy"></setColumnFields>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <span slot="oneRowName" slot-scope="text, record">
          <span v-if="text" class="oneRowName" :title="text">{{text}}</span>
        </span>
        <span slot="tag" slot-scope="text, record">
          <template v-if="text">
            <span class="tagSpan" v-for="(item,index) in text.split(',')">{{item}}</span>
          </template>
        </span>
        <span slot="tagJSON" slot-scope="text, record">
          <template v-if="text">
            <span class="tagSpan" v-for="(item,index) in JSON.parse(text)">{{item}}</span>
          </template>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'detail')">详情</a>

          
          <a @click="handleEdit(record)">编辑</a>

          
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record)">
            <a>删除</a>
          </a-popconfirm>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <companyInfo-modal ref="modalForm" @ok="modalFormOk"></companyInfo-modal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import CompanyInfoModal from './modules/CompanyInfoModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import setColumnFields from '@/components/setColumnsFields'
  export default {
    name: "CompanyInfoList",
    mixins:[JeecgListMixin],
    components: {
        CompanyInfoModal,setColumnFields
    },
    data () {
      return {
        description: '企业基本信息表页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
           },
		   {
            title: '统一信用代码',
            align:"center",
            dataIndex: 'CompanyCode',
            isKey:true
           },
		   {
            title: '公司简称',
            align:"center",
            dataIndex: 'CompanyAbbr',
            isKey:true
           },
           {
            title: '公司全称',
            align:"center",
            dataIndex: 'CompanyName',
            isKey:true
           },
           // {
           //  title: '所属园区',
           //  align:"center",
           //  dataIndex: 'HighteckPark_ParkName'
           // },
           {
            title: '落地园区',
            align:"center",
            dataIndex: 'SubPark_ParkName'
           },
           {
            title: '法人',
            align:"center",
            dataIndex: 'LegalPerson'
           },
           {
            title: '成立日期',
            align:"center",
            dataIndex: 'RegisteredDate',
            customRender:function (t,r,index) {
              return t?t.split(' ')[0]:'';
            }
           },
           {
            title: '经营状态',
            align:"center",
            dataIndex: 'OperationStatus_Value'
           },
           {
            title: '注册资本',
            align:"center",
            dataIndex: 'RegisteredAmt',
            customRender:function (t,r,index) {
              return t?t+'万':'';
            }
           },
           {
            title: '注册币种',
            align:"center",
            dataIndex: 'CurrencyType_Value'
           },
           {
            title: '一级行业',
            align:"center",
            dataIndex: 'PrimaryIndustry_Industry'
           },{
            title: '二级行业',
            align:"center",
            dataIndex: 'Industry_Industry'
           },
           {
            title: '三级行业',
            align:"center",
            dataIndex: 'SubIndustries',
            scopedSlots: { customRender: 'tag' },
           },
       {
            title: '公司标签',
            align:"center",
            dataIndex: 'IndustryTag',
            scopedSlots: { customRender: 'tag' },
           },
           {
            title: '资质标签',
            align:"center",
            dataIndex: 'QualificationTag',
            scopedSlots: { customRender: 'tagJSON' },
           },
		   {
            title: '一句话简介',
            align:"center",
            dataIndex: 'CompanyBrief',
            scopedSlots: { customRender: 'oneRowName' },
           },
           {
            title: '公司介绍',
            align:"center",
            dataIndex: 'CompanyDepiction',
            scopedSlots: { customRender: 'oneRowName' },
           },
		   
		   
		   // {
     //        title: '实缴资本',
     //        align:"center",
     //        dataIndex: 'paidinamt'
     //       },
		   // {
     //        title: '经营范围',
     //        align:"center",
     //        dataIndex: 'businessscope'
     //       },
		   
		   
		   // {
     //        title: '所在城市',
     //        align:"center",
     //        dataIndex: 'cityid'
     //       },
		   // {
     //        title: '注册区/县',
     //        align:"center",
     //        dataIndex: 'registereddistrictid'
     //       },
		   // {
     //        title: '注册详细地址',
     //        align:"center",
     //        dataIndex: 'registeredaddress'
     //       },
		   // {
     //        title: '办公区/县',
     //        align:"center",
     //        dataIndex: 'officedistrictid'
     //       },
		   // {
     //        title: '办公详细地址',
     //        align:"center",
     //        dataIndex: 'officeaddress'
     //       },
		   // {
     //        title: '办公与注册是否一致',
     //        align:"center",
     //        dataIndex: 'isregoffsame'
     //       },
		   // {
     //        title: '是否高新企业',
     //        align:"center",
     //        dataIndex: 'ishigtech'
     //       },
		   // {
     //        title: '是否有BP',
     //        align:"center",
     //        dataIndex: 'isbp'
     //       },
		   // {
     //        title: '团队标签',
     //        align:"center",
     //        dataIndex: 'teamtag'
     //       },
		   // {
     //        title: '团队描述',
     //        align:"center",
     //        dataIndex: 'teamremark'
     //       },
		   // {
     //        title: '人员规模',
     //        align:"center",
     //        dataIndex: 'staffsizeid'
     //       },
		   // {
     //        title: '纳税规模',
     //        align:"center",
     //        dataIndex: 'taxedsizeid'
     //       },
		   // {
     //        title: '估值规模',
     //        align:"center",
     //        dataIndex: 'valuationsizeid'
     //       },
		   // {
     //        title: '融资轮次',
     //        align:"center",
     //        dataIndex: 'refinanceroundid'
     //       },
		   // {
     //        title: '互动周期',
     //        align:"center",
     //        dataIndex: 'interactivecycleid'
     //       },
		   // {
     //        title: '服务状态',
     //        align:"center",
     //        dataIndex: 'servicestatusid'
     //       },
		   // {
     //        title: 'Linker',
     //        align:"center",
     //        dataIndex: 'linkerid'
     //       },
		   // {
     //        title: '最近更新人',
     //        align:"center",
     //        dataIndex: 'updatebyid'
     //       },
		   // {
     //        title: '最近更新日期',
     //        align:"center",
     //        dataIndex: 'ts'
     //       },
		   // {
     //        title: '状态',
     //        align:"center",
     //        dataIndex: 'datastatus'
     //       },
		   // {
     //        title: '互动标签',
     //        align:"center",
     //        dataIndex: 'interactivetag'
     //       },
          {
            title: '最近更新人',
            align:"center",
            dataIndex: 'UpdateBy_Name',
            isKey:true
           },
          {
            title: '最近更新日期',
            align:"center",
            dataIndex: 'Ts',
            customRender:function (t,r,index) {
              return t?new Date(parseInt(t)).toLocaleDateString().replace('/','-').replace('/','-'):'';
            }
           },
          {
            title: '操作',
            dataIndex: '',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
		url: {
          list: "/companyInfo/queryRows?companyType=0",
          delete: "/companyInfo/delete",
          deleteBatch: "/robot/companyInfo/deleteBatch",
          exportXlsUrl: "robot/companyInfo/exportXls",
          importExcelUrl: "companyInfo/import/excel",
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
    methods: {
     
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>